package com.frinder.seata.account.web;

import com.frinder.seata.account.service.BizAccountService;
import com.frinder.seata.data.base.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.math.BigDecimal;

@RestController
@RequestMapping("/biz/account")
public class BizAccountController {

    @Resource
    private BizAccountService bizAccountService;

    @ApiOperation("扣减账户金额&反馈订单完成")
    @PostMapping("/decrease")
    public Result decrease(@RequestParam boolean timeout,
                           @RequestParam long userId,
                           @RequestParam BigDecimal money,
                           @RequestParam long orderId,
                           @RequestParam boolean circle
    ) {
        bizAccountService.decrease(timeout, userId, money, orderId, circle);
        return Result.defSuccess();
    }

}
